package network;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.EndPoint;

public class ClassRegister {

    static private final Class[] requestClasses = {
        network.data.request.DolaczenieSieDoGry.class,
        network.data.request.GotowyNaStart.class,
        network.data.request.ListaPokojow.class,
        network.data.request.OdnowienieHasla.class,
        network.data.request.Ranking.class,
        network.data.request.Rejestrowanie.class,
        network.data.request.StartowanieGry.class,
        network.data.request.StatusPokoju.class,
        network.data.request.StatystykaGracza.class,
        network.data.request.TworzenieNowejGry.class,
        network.data.request.WysylanieWiadomosci.class,
        network.data.request.Zalogowanie.class,
        network.data.request.ZmianaSlotu.class,
        network.data.request.ZmuszenieStartu.class
    };
    static private final Class[] responeClasses = {
        network.data.respone.DolaczenieSieDoGry.class,
        network.data.respone.GotowyNaStart.class,
        network.data.respone.ListaPokojow.class,
        network.data.respone.OdnowienieHasla.class,
        network.data.respone.Ranking.class,
        network.data.respone.Rejestrowanie.class,
        network.data.respone.StartowanieGry.class,
        network.data.respone.StatusPokoju.class,
        network.data.respone.StatystykaGracza.class,
        network.data.respone.TworzenieNowejGry.class,
        network.data.respone.WysylanieWiadomosci.class,
        network.data.respone.Zalogowanie.class,
        network.data.respone.ZmianaSlotu.class,
        network.data.respone.ZmuszenieStartu.class,
        network.data.respone.OgolnaWiadomosc.class
    };

    static private void registerClasses(Kryo kryo) {
        System.out.println("registerClasses _ called");
        for (int i = 0; i < requestClasses.length; i++) {
            kryo.register(requestClasses[i]);
        }

        for (int i = 0; i < responeClasses.length; i++) {
            kryo.register(responeClasses[i]);
        }
    }

    static public void register(EndPoint endPoint) {
        Kryo kryo = endPoint.getKryo();
        registerClasses(kryo);
    }
}